/** @format */

// 用户模型
// Author 区区电脑
// Email 1573580882@qq.com
// Date 2023-01-28
// Copyright © 2023 gys. All rights reserved.

export default class UserModel {
	// id
	id = null;
	// 昵称
	nickName = null;
	// 是否超级管理员
	isAdmin = null;
	// 手机号
	phone = null;
	// 邮箱
	email = null;
	// 真实姓名
	realName = null;
	// 用户类型
	type = null;
	// 用户状态
	state = null;
	// 组织 id
	orgId = null;
	// 职位 id
	postId = null;
    // 角色 codes
    rules = null;
	// 性别
	sex = null;
	// 头像
	avatar = null;
	// 身份证
	idCard = null;
	// 微信
	wechat = null;
	// 企业微信
	companyWechat = null;
    // 学分
    studyScore = 0;
    // 源数据
    sourceData = {};

	constructor(options) {
		this.id = options.id;
		this.nickName = options.userName || options.phone;
		this.isAdmin = options.isAdmin == 1;
		this.phone = options.phone;
		this.email = options.email;
		this.realName = options.realName;
		this.type = options.userType || 0;
		this.state = options.userStatus || 0;
		this.orgId = options.sysOrgId;
		this.areaCode = options.areaCode;
		this.postId = options.sysPostId;
        this.rules = options.rules || [];
		this.sex = options.gender || 0;
		this.avatar = options.headerImg || "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png";
		this.idCard = options.identityCard;
		this.wechat = options.weChat;
		this.companyWechat = options.qYWeChat;
		this.studyScore = options.studyScore;
        this.sourceData = options;
	}
}
